Conventionally, an image forming apparatus is known that forms, on an image bearing member, an image pattern of which a portion is transferred onto a transfer medium, that detects the image pattern after the portion is transferred onto the transfer medium with toner-image detecting means, and that adjusts writing timing of an image based on the detection result.